<%@ page language="java" contentType="text/html; charset=ISO-8859-1" import="java.sql.*,java.util.ArrayList,org.adg.code.model.OpenReportList;"
    pageEncoding="ISO-8859-1"%>
 <%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>   
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>ADG-Open Report</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style2 {font-size: 52px; color: #333333; font-family: "Monotype Corsiva";}
#Layer1 {
	position:absolute;
	width:430px;
	height:29px;
	z-index:1;
	left: 196px;
	top: 94px;
}
.style4 {font-size: 22px; color: #333333; font-family: "Monotype Corsiva"; }
#Layer2 {
	position:absolute;
	width:124px;
	height:159px;
	z-index:1;
	left: 75px;
	top: 213px;
}
.style7 {font-size: 14px; color: #333333; }
.style8 {font-size: 26px}
#Layer3 {
	position:absolute;
	width:269px;
	height:32px;
	z-index:2;
	left: 4px;
	top: 126px;
}
.style9 {
	font-size: 25px;
	font-family: "Times New Roman", Times, serif;
	color: #000000;
}
#Layer4 {
	position:absolute;
	width:128px;
	height:34px;
	z-index:3;
	left: 1206px;
	top: 125px;
}
.style10 {font-size: 20px; font-family: "Times New Roman", Times, serif; color: #000000; }
#Layer5 {
	position:absolute;
	width:825px;
	height:34px;
	z-index:2;
	left: 27px;
	top: 129px;
}
#Layer6 {
	position:absolute;
	width:40%;
	height:81px;
	z-index:4;
	left: 30%;
	top: 215px;
}
#Layer7 {
	position:absolute;
	width:50%;
	height:115px;
	z-index:5;
	left: 25%;
	top: 377px;
}
.msgstyle {color: red;font-size: 20px;
	font-family: Georgia, "Times New Roman", Times, serif;}
.style1 {color: #000000;font-size: 16px;
	font-family: Georgia, "Times New Roman", Times, serif;}
-->
</style>

</head>
<%String ch=(String)request.getAttribute("flag"); 

%>
<body onLoad="init();">
<jsp:include page="head.jsp" />
<Script Language="JavaScript">  
function init()
{
	<%if(ch=="1"){
	String catg=(String)request.getAttribute("repcat");%>
	document.getElementById("catgname").value="<%=catg%>";
	document.getElementById("rname").value="<%=catg%>";
	<%}%>

}

var val="";
function setvalue(ch)
{
val=ch;
}
function setparam()
{
	//document.getElementById("rname").value="asadf";
	if(val=="")
	{
		alert ( "Please select Report." ); 
	}
	else
		{
			document.getElementById("form2").action="adg.do?method=showreport&name="+val;
			document.getElementById("form2").submit();
		}
}






function ValidateForm(form){ 
var sel=document.getElementById("rname");
if ( sel.selectedIndex == 0 ) 
{ 
	alert ( "Please select Report Category." ); 
	return false;
} 
else 
	return true;
} 



</Script>  

<div id="Layer6">

  <form name="form1" method="post" action="adg.do?method=openreportlist"  onsubmit="return ValidateForm()">
    <label>
    <div align="center" class="style1">Report Category
      <select id="rname" name="rname">
      <option>---select---</option>
<% 
	
		ResultSet resultSet = (ResultSet)request.getAttribute("resultset");
		while(resultSet.next())
		{
			String uname=resultSet.getString(1);

%>
			<option value="<%=uname%>"><%=uname%></option>
<%
		}
	
%>
		
      </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     
      <input type="submit" name="Submit2" class="button" value="Go">
    
    </div>
    </label>
    <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
   
  </form>
 
 <form name="form2" id="form2" method="post" action="">
 <%
 String f=(String)request.getAttribute("flag"); 
 if(f=="1")
 {OpenReportList or=(OpenReportList)request.getAttribute("rlist");
 ArrayList a=or.getList();
  %>
  <%if(a.size()>0){%>
  <div align="center" class="style1">Select Report</div>
  <table width="336" align="center" border="1">
    <%for(int i=0;i<a.size();i++){%>
    <tr>
      <td><div align="justify" class="style1"><br><input type="radio" name="group1" value="<%=a.get(i) %>" onClick="setvalue('<%=a.get(i) %>')"><%=a.get(i)%><br></div></td>
    </tr>
    <%} %>
  </table>
  
   <div align="center">
   	
   	<p>&nbsp;</p>
       <input type="button" name="Submit" class="button" value="open" onClick="setparam(this.form)"/>
   	<%}else{%>
   	<div align="center" class="msgstyle"><u><font color="red">No report under this category</font></u></div>
   	<p>&nbsp;</p>
   	<%} %>
  </div>
  <%} %>
  <input type="hidden" id="catgname" name="catgname" value=""/>

</form></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><br />
</p>

 
<form id="linkform" name="linkform" method="post" action="">
 
</form>
</body>
</html>
